package com.unitTest;

import static org.junit.Assert.*;

import org.junit.Test;

import com.acmetelecom.BillingSystem;
import com.acmetelecom.CallEnd;
import com.acmetelecom.CallEvent;
import com.acmetelecom.CallStart;

public class Test1 {
	
	public static void test(String caller, String callee, long call_start, long call_end, double cost) {
		FakeGenerator fg = new FakeGenerator();
		BillingSystem billingsystem = new BillingSystem(fg);
		
		CallEvent e1 = new CallStart(caller,callee,call_start);
		CallEvent e2 = new CallEnd(caller,callee,call_end);
		
		billingsystem.addCall(e1);
		billingsystem.addCall(e2);
		
		billingsystem.createCustomerBills();
		
		System.out.println("Total:" + fg.getBill());
		assertTrue(fg.getBill()==cost);
	}

	//10 seconds off-peak
	@Test
	public void simpletest() {
		Test1.test("447722113434", "447766814143", 0, 10000, 0.03);
	}
	
	@Test
	public void advancedtest() {
		Test1.test("447722113434", "447766814143", 30000000, 30010000, 0.03);
	}
	
	@Test
	public void test2() {
		Test1.test("447777765432", "447766814143", 0, 10000, 0.02);
	}
}
